//
//  OrderGoodsInforTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/7.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "OrderGoodsInforTableViewCell.h"

@interface OrderGoodsInforTableViewCell ()
@property (nonatomic,strong) GLGWLabel * stellNameLabel;
@property (nonatomic,strong) GLGWLabel * specLabel;
@property (nonatomic,strong) GLGWLabel * piceLabel;
@property (nonatomic,strong) GLGWLabel * goodsNumLabel;

@end

@implementation OrderGoodsInforTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.stellNameLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:self.contentView];
        self.stellNameLabel.text = @"三级螺纹钢 HRB400E 河钢";
        self.stellNameLabel.numberOfLines = 0;
        [self.stellNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
        }];
        //
        self.specLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self.contentView];
        self.specLabel.text = @"φ6*12";
        [self.specLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.stellNameLabel);
            make.top.equalTo(self.stellNameLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        //
        self.piceLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:self.contentView];
        self.piceLabel.attributedText = [GLGWLabel bllChangeStr:@"¥3845（4.69吨）" changewithStr:@"（4.69吨）" changeColoer:[UIColor colorWithHexString:@"#EC5353"] withFont:SYSTEMFONT(12)];
        [self.piceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.specLabel);
            make.top.equalTo(self.specLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        //
        self.goodsNumLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self.contentView];
        self.goodsNumLabel.text = @"35件";
        [self.goodsNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(15));
        }];
    }
    return self;
}

- (void)refreshOrderGoodsInforTableViewCell:(OrderInfomationDetailDataInfoModel *)model index:(NSIndexPath *)index
{
    OrderInfomationDetailDataInfoOrderGoodsModel *goodsModel = model.orderGoods[index.row];
    self.stellNameLabel.text = goodsModel.productMaterial;
    self.specLabel.text = goodsModel.specifications;
    NSString *modiPrice = [NSString stringWithFormat:@"%@",goodsModel.modifyPrice];
    if (modiPrice.length <= 0) {
        modiPrice = [NSString stringWithFormat:@"%@",goodsModel.price];
    }
    NSString *bllStr = [NSString stringWithFormat:@"(%@吨)",goodsModel.weightCounting];
    NSString *str = [NSString stringWithFormat:@"¥%@ %@",modiPrice,bllStr];
    self.piceLabel.attributedText = [GLGWLabel bllChangeStr:str changewithStr:bllStr changeColoer:[UIColor colorWithHexString:@"#EC5353"] withFont:SYSTEMFONT(12)];
    self.goodsNumLabel.text = [NSString stringWithFormat:@"%ld件",goodsModel.goodsNum];
}

@end
